package com.nova.bluetooth.ui.bluetoothDemo;

import android.annotation.SuppressLint;
import android.os.CountDownTimer;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.dido.fastblelib.utils.HexUtil;
import com.nova.bluetooth.bean.DeviceConfigBean;
import com.nova.bluetooth.helpUtils.BluetoothDataUtil;
import com.nova.bluetooth.manage.BluetoothHelper;
import com.nova.bluetooth.myEnum.DenoiseMode;
import com.nova.bluetooth.myEnum.DenoiseModeLevel;
import com.nova.bluetooth.myEnum.EQModel;
import com.nova.bluetooth.myEnum.FindDeviceModel;
import com.nova.bluetooth.myEnum.ImmersionModel;
import com.nova.bluetooth.myEnum.KeyFunctionClickModel;
import com.nova.bluetooth.myEnum.KeyFunctionControlModel;
import com.nova.bluetooth.myEnum.LightModel;
import com.nova.bluetooth.myEnum.SleepModel;
import com.nova.bluetooth.myEnum.SpaceModel;
import com.nova.bluetooth.myEnum.TFModel;

import java.util.ArrayList;
import java.util.List;

import kotlin.Pair;

@SuppressLint("DefaultLocale")
public class NovaBluetoothControlViewModel extends ViewModel {
    public static final String TAG = "BluetoothControlViewModel";
    public MutableLiveData<Boolean> isConnectedLiveData = new MutableLiveData<>(false);
    public MutableLiveData<Pair<String, Boolean>> logStringLiveData = new MutableLiveData<>(); //Log显示 Pair1为内容 Pair2为是否加粗提示
    public MutableLiveData<String> leftBatteryText = new MutableLiveData<>("--%");
    public MutableLiveData<String> rightBatteryText = new MutableLiveData<>("--%");
    public MutableLiveData<String> binBatteryText = new MutableLiveData<>("--%");

    public MutableLiveData<EQModel> eqModelMutableLiveData = new MutableLiveData<>(EQModel.SSQVP);
    public MutableLiveData<Integer> eqSetBoxResultMutableLiveData = new MutableLiveData<>();

    public MutableLiveData<Boolean> isEarDetectionOpenLiveData = new MutableLiveData<>(false);
    public MutableLiveData<Boolean> isGameModelOpenLiveData = new MutableLiveData<>(false);

    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_L_One_LiveData = new MutableLiveData<>(KeyFunctionControlModel.Previous);
    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_R_One_LiveData = new MutableLiveData<>(KeyFunctionControlModel.Next);
    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_L_D_LiveData = new MutableLiveData<>(KeyFunctionControlModel.Previous);
    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_R_D_LiveData = new MutableLiveData<>(KeyFunctionControlModel.Next);
    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_L_T_LiveData = new MutableLiveData<>(KeyFunctionControlModel.VolumeUp);
    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_R_T_LiveData = new MutableLiveData<>(KeyFunctionControlModel.VolumeDown);
    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_L_Long_LiveData = new MutableLiveData<>(KeyFunctionControlModel.Previous);
    public MutableLiveData<KeyFunctionControlModel> keyFunctionControlModel_R_Long_LiveData = new MutableLiveData<>(KeyFunctionControlModel.Next);

    public MutableLiveData<Integer> denoiseSetResultMutableLiveData = new MutableLiveData<>();
    public MutableLiveData<Pair<DenoiseMode, DenoiseModeLevel>> denoiseMutableLiveData = new MutableLiveData<>(
            new Pair<>(DenoiseMode.NOISE_MODE_DENOISE, DenoiseModeLevel.NOISE_MODE_LEVEL_MILD));

    public MutableLiveData<Integer> findDeviceModelResultMutableLiveData = new MutableLiveData<>(0);

    public MutableLiveData<SleepModel> sleepModelMutableLiveData = new MutableLiveData<>(SleepModel.Standard);
    public MutableLiveData<Integer> sleepModelSetResultMutableLiveData = new MutableLiveData<>(0);

    public MutableLiveData<SpaceModel> spaceModelMutableLiveData = new MutableLiveData<>(SpaceModel.Music);
    public MutableLiveData<ImmersionModel> immersionModelMutableLiveData = new MutableLiveData<>(ImmersionModel.Off);

    public MutableLiveData<Integer> volumeMutableLiveData = new MutableLiveData<>(0);
    public MutableLiveData<TFModel> tfModelMutableLiveData = new MutableLiveData<>(TFModel.Bluetooth);

    public MutableLiveData<LightModel> lightModelMutableLiveData = new MutableLiveData<>(LightModel.DefModel);
    public MutableLiveData<Boolean> isFMOpenLiveData = new MutableLiveData<>(false);


    /**
     * 数据解析
     *
     * @param data
     */
    public void dealWithData(byte[] data) {
        switch (data[2]) {
            case 0x05: //电量
                setBatteryByData(data);
                break;
            case 0x07: //设置eq成功，设备返回EQ设置模式
                eqModelMutableLiveData.postValue(getEQ(data));
                break;
            case (byte) 0x0D: //入耳检测开关状态获取
                isEarDetectionOpenLiveData.postValue(data[4] == 0);
                break;
            case 0x09: //游戏模式状态
                isGameModelOpenLiveData.postValue(data[4] == 0);
                break;
            case 0x06:
                setKeyFunctionLiveData(data);
                break;
            case (byte) 0x0B:
                setDenoiseModeMutableLiveData(data);
                break;
            case (byte) 0x62:
                findDeviceModelResultMutableLiveData.postValue((int) data[4]);
                break;
            case (byte) 0x0C:
                setImmersionModelMutableLiveDataByDate(data);
                break;

        }
    }


    private void setBatteryByData(byte[] data) {
        switch (data[4]) {
            case 0x00:
                leftBatteryText.postValue(String.format("%d%%", data[5]));
                rightBatteryText.postValue(String.format("%d%%", data[6]));
                break;
            case 0x02: //仓电量
                binBatteryText.postValue(String.format("%d%%", data[5]));
                break;
        }
    }

    private void setLightModelMutableLiveDataByData(byte[] data) {
        LightModel lightModel = LightModel.DefModel;
        switch (data[3]) {
            case 0x00:
                lightModel = LightModel.DefModel;
                break;
            case 0x01:
                lightModel = LightModel.Light1;
                break;
            case 0x02:
                lightModel = LightModel.Light2;
                break;
            case 0x03:
                lightModel = LightModel.Light3;
                break;
            case 0x04:
                lightModel = LightModel.Light4;
                break;
            case 0x05:
                lightModel = LightModel.Light5;
                break;

        }
        lightModelMutableLiveData.postValue(lightModel);
    }


    private void setTFModelMutableLiveDataByDate(byte[] data) {
        TFModel tfModel = TFModel.Bluetooth;
        switch (data[3]) {
            case 0x01:
                tfModel = TFModel.Bluetooth;
                break;
            case 0x00:
                tfModel = TFModel.TF;
                break;
        }
        tfModelMutableLiveData.postValue(tfModel);
    }


    private void setImmersionModelMutableLiveDataByDate(byte[] data) {
        ImmersionModel immersionModel = ImmersionModel.Off;
        switch (data[4]) {
            case 0x01:
                immersionModel = ImmersionModel.Off;
                break;
            case 0x02:
                immersionModel = ImmersionModel.Statical;
                break;
            case 0x03:
                immersionModel = ImmersionModel.Dynamic;
                break;
        }
        immersionModelMutableLiveData.postValue(immersionModel);
    }

    private void setSpaceModelMutableLiveDataByDate(byte[] data) {
        SpaceModel spaceModel = SpaceModel.Music;
        switch (data[3]) {
            case 0x01:
                spaceModel = SpaceModel.Music;
                break;
            case 0x02:
                spaceModel = SpaceModel.Sport;
                break;
            case 0x03:
                spaceModel = SpaceModel.Video;
                break;
            case 0x04:
                spaceModel = SpaceModel.Empty;
                break;
        }
        spaceModelMutableLiveData.postValue(spaceModel);
    }


    private void setSleepModelMutableLiveDataByDate(byte[] data) {
        SleepModel sleepModel = SleepModel.Standard;
        switch (data[3]) {
            case 0x00:
                sleepModel = SleepModel.Standard;
                break;
            case 0x01:
                sleepModel = SleepModel.Sleep;
                break;
            case 0x02:
                sleepModel = SleepModel.LowPower;
                break;
        }
        sleepModelMutableLiveData.postValue(sleepModel);
    }

    private void setDenoiseModeMutableLiveData(byte[] data) {
        DenoiseMode denoiseMode = DenoiseMode.NOISE_MODE_DENOISE;
        DenoiseModeLevel denoiseModeLevel = DenoiseModeLevel.NOISE_MODE_LEVEL_NULL;
        switch (data[4]) {
            case 0x00:
                denoiseMode = DenoiseMode.NOISE_MODE_OFF;
                break;
            case 0x01:
                denoiseMode = DenoiseMode.NOISE_MODE_DENOISE;
                break;
            case 0x02:
                denoiseMode = DenoiseMode.NOISE_MODE_TRANSPARENT;
                break;
        }

//        switch (data[4]) {
//            case 0x00:
//                denoiseModeLevel = DenoiseModeLevel.NOISE_MODE_LEVEL_MILD;
//                break;
//            case 0x01:
//                denoiseModeLevel = DenoiseModeLevel.NOISE_MODE_LEVEL_MEDIUM;
//                break;
//            case 0x02:
//                denoiseModeLevel = DenoiseModeLevel.NOISE_MODE_LEVEL_SEVERE;
//                break;
//            case 0x03:
//                denoiseModeLevel = DenoiseModeLevel.NOISE_MODE_LEVEL_NULL;
//                break;
//        }
        denoiseMutableLiveData.postValue(new Pair<>(denoiseMode, denoiseModeLevel));
    }

    private void setKeyFunctionLiveData(byte[] data) {
        if (data[4] == 0x00){ //左耳

            if (data[5] == 0x01){ //双击
                keyFunctionControlModel_L_D_LiveData.postValue(getKeyFunctionControlModelByData(data));
            }else if (data[5] == 0x02){ //三击
                keyFunctionControlModel_L_T_LiveData.postValue(getKeyFunctionControlModelByData(data));
            }
        }else if (data[4] == 0x01){ //右耳

            if (data[5] == 0x01){ //双击
                keyFunctionControlModel_R_D_LiveData.postValue(getKeyFunctionControlModelByData(data));
            }else if (data[5] == 0x02){ //三击
                keyFunctionControlModel_R_T_LiveData.postValue(getKeyFunctionControlModelByData(data));
            }
        }

    }

    private KeyFunctionControlModel getKeyFunctionControlModelByData(byte[] data) {
        switch (data[6]) {
            case 0x00:
                return KeyFunctionControlModel.PlayOrPause;
            case 0x01:
                return KeyFunctionControlModel.Previous;
            case 0x02:
                return KeyFunctionControlModel.Next;
            case 0x03:
                return KeyFunctionControlModel.VolumeUp;
            case 0x04:
                return KeyFunctionControlModel.VolumeDown;
        }
        return KeyFunctionControlModel.PlayOrPause;
    }

    private EQModel getEQ(byte[] data) {
        switch (data[4]) {
            case 0x00:
                return EQModel.SSQVP;
            case 0x01:
                return EQModel.POP;
            case 0x02:
                return EQModel.ROCK;
            case 0x03:
                return EQModel.CLASSIC;
            case 0x04:
                return EQModel.LYRIC;
            case 0x05:
                return EQModel.SOFT;
        }
        return EQModel.SSQVP;
    }


    /********************************一键测试指令***********************************/
    //载入指令 （根据配置表载入）
    //发送
    //接收校验

    private CountDownTimer countDownTimer;
    private final long CHECK_TIME_INTERVAL = 25000; // N秒
    private boolean isFirstOnTick = true;

    private void startTimer() {
        isFirstOnTick = true;
        countDownTimer = new CountDownTimer(Integer.MAX_VALUE, CHECK_TIME_INTERVAL) {
            @Override
            public void onTick(long millisUntilFinished) {
                if (!isFirstOnTick) {
                    if (mTestCMDResultEndListener != null) {
                        mTestCMDResultEndListener.onTestCMDResultEnd();
                        countDownTimer.cancel();
                    }
                }
                isFirstOnTick = false;
            }

            @Override
            public void onFinish() {

            }
        }.start();
    }


    List<Pair<Pair<String, byte[]>, Pair<Boolean, Boolean>>> mTestCMDList;

    public void sendTestCMD(TestCMDResultEndListener endListener, DeviceConfigBean configBean, boolean isGetStateTest) {
        mTestCMDResultEndListener = endListener;
        startTimer();
        if (mTestCMDList == null) {
            mTestCMDList = new ArrayList<>();
        } else {
            mTestCMDList.clear();
        }

        mTestCMDList = setTestCMD(configBean, isGetStateTest);
        mTestCMDList.forEach(pair -> {
            BluetoothHelper.getInstance().sendByteArrayDataSafety(pair.getFirst().getSecond());
        });
    }

    public void setTestCMDResultFirst(byte[] appData) {
        if (mTestCMDList == null || mTestCMDList.isEmpty()) {
            return;
        }

        if (appData[1] == 0x00 && appData[2] == 0x00 && appData[3] == 0x00) { //测试指令发送完成标识
            if (mTestCMDResultEndListener != null) {
                mTestCMDResultEndListener.onTestCMDResultEnd();
                if (countDownTimer != null) {
                    countDownTimer.cancel();
                }
            }
            return;
        }

        for (int i = 0; i < mTestCMDList.size(); i++) {
            if (mTestCMDList.get(i).getFirst().getSecond() == appData) {
                mTestCMDList.set(i, new Pair<>(
                        new Pair<>(mTestCMDList.get(i).getFirst().getFirst() + "\nAPP发送==>" + HexUtil.encodeHexStr(appData),
                                mTestCMDList.get(i).getFirst().getSecond()),
                        new Pair<>(true, false)));
                break;
            }
        }
    }

    public void setTestCMDResultSecond(byte[] deviceData) {
        if (mTestCMDList == null || mTestCMDList.isEmpty()) {
            return;
        }

        for (int i = 0; i < mTestCMDList.size(); i++) {
            byte[] testByte = mTestCMDList.get(i).getFirst().getSecond();

            boolean isResultOk = false;
            switch (deviceData[1]) {
                case 0x32: //左耳电量
                case 0x33: //右耳电量 和骨传导耳机的电量
                case 0x34: //仓电量
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;

                case 0x39: //TWS 设置eq成功，设备返回EQ设置模式
                    if (testByte[1] == deviceData[1] && testByte[3] == deviceData[3]) {
                        isResultOk = true;
                    }
                    break;
                case 0x76: //APP 获取eq状态
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;
                case 0x77: //音箱EQ设置成功/失败 ==》 0：成功 1：失败
                    if (testByte[1] == deviceData[1] && deviceData[3] == 0x00 && !mTestCMDList.get(i).getSecond().getSecond()) {
                        isResultOk = true;
                    }
                    break;
                case 0x19: //入耳检测开关状态获取
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;
                case 0x41: //游戏模式状态
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;

                case 0x35:
                case 0x36:
                case 0x37:
                case 0x38:
                    if (testByte[1] == deviceData[1] && testByte[3] == deviceData[3]) {
                        isResultOk = true;
                    }
                    break;

                case (byte) 0x60://噪声控制
                case (byte) 0x62://查找设备
                case (byte) 0x63://睡眠模式设置
                    if (testByte[1] == deviceData[1] && deviceData[3] == 0x00 && !mTestCMDList.get(i).getSecond().getSecond()) {
                        isResultOk = true;
                    }
                    break;

                case (byte) 0x64:
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;
                case (byte) 0x80:
                    if (testByte[1] == deviceData[1] && testByte[3] == deviceData[3]) {
                        isResultOk = true;
                    }
                    break;
                case (byte) 0x81:
                case (byte) 0x00: //音量获取
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;

                case (byte) 0x45:
                case (byte) 0x46:
                    if (testByte[1] == deviceData[1] && deviceData[3] == 0x00) {
                        isResultOk = true;
                    }
                    break;
                case (byte) 0x48: //获取TF模式状态
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;
                case (byte) 0x6b: //获取灯光模式
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;
                case (byte) 0x69:
                    if (testByte[1] == deviceData[1]) {
                        isResultOk = true;
                    }
                    break;
            }


            if (isResultOk && mTestCMDList.get(i).getSecond().getFirst()) {
                mTestCMDList.set(i, new Pair<>(
                        new Pair<>(mTestCMDList.get(i).getFirst().getFirst() + "\nAPP接收==>" + HexUtil.encodeHexStr(deviceData),
                                mTestCMDList.get(i).getFirst().getSecond()),
                        new Pair<>(mTestCMDList.get(i).getSecond().getFirst(), true)));
                break;
            }
        }
    }


    /**
     * 检查指令发送接收结果并输出；
     * 在等待发送结束或超时的时候调用合适；
     */
    public void checkTestCMDResultLogOutput() {
        logStringLiveData.setValue(new Pair<>("\n 一键测试结果输出=========================》开始\n", true));

        if (mTestCMDList != null && !mTestCMDList.isEmpty()) {
            mTestCMDList.forEach(pair -> {
                Pair<Boolean, Boolean> testResult = pair.getSecond();
                String cmdDesc = pair.getFirst().getFirst(); // 指令说明

                if (!cmdDesc.contains("测试结束")) {

                    if (testResult.getFirst()) {
                        if (testResult.getSecond()) {
                            logStringLiveData.setValue(new Pair<>("APP指令测试通过:" + cmdDesc, false));
                        } else {
                            logStringLiveData.setValue(new Pair<>("APP指令测试失败,未收到设备回复:" + cmdDesc, true));
                        }
                    } else {
                        logStringLiveData.setValue(new Pair<>("APP指令测试失败,指令无法发送:" + cmdDesc, true));
                    }

                    logStringLiveData.setValue(new Pair<>("\n", true));
                }
            });
        }
        logStringLiveData.setValue(new Pair<>("一键测试结果输出=========================》结束\n", true));
    }

    private List<Pair<Pair<String, byte[]>, Pair<Boolean, Boolean>>> setTestCMD
            (DeviceConfigBean configBean, boolean isGetStateTest) {
        //String：指令说明      byte[]:测试指令       Boolean1：是否发送成功      Boolean2 设备是否回应
        List<Pair<Pair<String, byte[]>, Pair<Boolean, Boolean>>> testCMDList = new ArrayList<>();

        // 在这里加入需要测试的指令 ===>根据配置的功能添加测试指令
//        testCMDList.add(new Pair<>(
//                new Pair<>("设置蓝牙模式", HexUtil.hexStringToBytes("AA410100EC")),
//                new Pair<>(false, false)));

        configBean.getSupportList().forEach(supportId -> {
            switch (supportId) {
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0105:
                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_0206:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_0306:
                    //BLE蓝牙断开
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0106:
                    //入耳检测
                    if (isGetStateTest) {
                        byte[] earDetectionCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_EAR_DETECTION));
                        testCMDList.add(new Pair<>(new Pair<>("入耳检测开关状态获取", earDetectionCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("入耳检测开", BluetoothDataUtil.getEarDetectionCMD(true)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("入耳检测关", BluetoothDataUtil.getEarDetectionCMD(false)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0107:
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0108:
                    //游戏模式
                    if (isGetStateTest) {
                        byte[] getGameStateCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GAME_MODEL));
                        testCMDList.add(new Pair<>(new Pair<>("获取是否游戏模式", getGameStateCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("游戏模式-开", BluetoothDataUtil.getGameModelSetCMD(true)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("游戏模式-关", BluetoothDataUtil.getGameModelSetCMD(false)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0109:
                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_0207:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_0309:
                    //恢复出厂设置
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_010a:
                    //左右耳电量
                    if (!isGetStateTest) break;

                    byte[] getLeftBatteryCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_LEFT_BATTERY));
                    byte[] getRightBatteryCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_RIGHT_BATTERY));
                    testCMDList.add(new Pair<>(new Pair<>("获取左耳机电量", getLeftBatteryCMD), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("获取右耳机电量", getRightBatteryCMD), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_010b:
                    //外壳电量
                    if (!isGetStateTest) break;

                    byte[] geBinBatteryCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_BIN_BATTERY));
                    testCMDList.add(new Pair<>(new Pair<>("获取外壳电量", geBinBatteryCMD), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_010c:
                    //按键功能设置与查询
                    if (isGetStateTest) {
                        byte[] getKeyFunction1Cmd = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_KEY_FUNCTION1));
                        byte[] getKeyFunction2Cmd = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_KEY_FUNCTION2));
                        byte[] getKeyFunction3Cmd = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_KEY_FUNCTION3));
                        byte[] getKeyFunction4Cmd = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_KEY_FUNCTION4));
                        testCMDList.add(new Pair<>(new Pair<>("获取左耳双击状态", getKeyFunction1Cmd), new Pair<>(false, false)));
                        testCMDList.add(new Pair<>(new Pair<>("获取右耳双击状态", getKeyFunction2Cmd), new Pair<>(false, false)));
                        testCMDList.add(new Pair<>(new Pair<>("获取左耳三击状态", getKeyFunction3Cmd), new Pair<>(false, false)));
                        testCMDList.add(new Pair<>(new Pair<>("获取右耳三击状态", getKeyFunction4Cmd), new Pair<>(false, false)));
                        break;
                    }


                    testCMDList.add(new Pair<>(new Pair<>("左耳双击-暂停/播放", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftDoubleClick, KeyFunctionControlModel.PlayOrPause)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳双击-上一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftDoubleClick, KeyFunctionControlModel.Previous)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳双击-下一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftDoubleClick, KeyFunctionControlModel.Next)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳双击-音量+", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftDoubleClick, KeyFunctionControlModel.VolumeUp)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳双击-音量-", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftDoubleClick, KeyFunctionControlModel.VolumeDown)), new Pair<>(false, false)));

                    testCMDList.add(new Pair<>(new Pair<>("左耳三击-暂停/播放", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftThreeShot, KeyFunctionControlModel.PlayOrPause)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳三击-上一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftThreeShot, KeyFunctionControlModel.Previous)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳三击-下一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftThreeShot, KeyFunctionControlModel.Next)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳三击-音量+", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftThreeShot, KeyFunctionControlModel.VolumeUp)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("左耳三击-音量-", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.LeftThreeShot, KeyFunctionControlModel.VolumeDown)), new Pair<>(false, false)));

                    testCMDList.add(new Pair<>(new Pair<>("右耳双击-暂停/播放", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightDoubleClick, KeyFunctionControlModel.PlayOrPause)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳双击-上一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightDoubleClick, KeyFunctionControlModel.Previous)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳双击-下一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightDoubleClick, KeyFunctionControlModel.Next)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳双击-音量+", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightDoubleClick, KeyFunctionControlModel.VolumeUp)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳双击-音量-", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightDoubleClick, KeyFunctionControlModel.VolumeDown)), new Pair<>(false, false)));

                    testCMDList.add(new Pair<>(new Pair<>("右耳三击-暂停/播放", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightThreeShot, KeyFunctionControlModel.PlayOrPause)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳三击-上一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightThreeShot, KeyFunctionControlModel.Previous)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳三击-下一曲", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightThreeShot, KeyFunctionControlModel.Next)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳三击-音量+", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightThreeShot, KeyFunctionControlModel.VolumeUp)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("右耳三击-音量-", BluetoothDataUtil.getKeyFunctionSetCMD(
                            KeyFunctionClickModel.RightThreeShot, KeyFunctionControlModel.VolumeDown)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_010d:
                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_0203:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_030e:
                    //EQ获取与设置
                    if (isGetStateTest) {
                        byte[] geEqCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_EQ));
                        testCMDList.add(new Pair<>(new Pair<>("获取EQ状态", geEqCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("EQ设置-SSQVP",
                            BluetoothDataUtil.getEQSetCMD(EQModel.SSQVP, configBean.getDeviceType())),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("EQ设置-POP",
                            BluetoothDataUtil.getEQSetCMD(EQModel.POP, configBean.getDeviceType())),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("EQ设置-ROCK",
                            BluetoothDataUtil.getEQSetCMD(EQModel.ROCK, configBean.getDeviceType())),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("EQ设置-CLASSIC",
                            BluetoothDataUtil.getEQSetCMD(EQModel.CLASSIC, configBean.getDeviceType())),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("EQ设置-LYRIC",
                            BluetoothDataUtil.getEQSetCMD(EQModel.LYRIC, configBean.getDeviceType())),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("EQ设置-SOFT",
                            BluetoothDataUtil.getEQSetCMD(EQModel.SOFT, configBean.getDeviceType())),
                            new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_010e:
                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_020b:
                    //噪声控制
                    if (isGetStateTest) {
                        byte[] geDenoiseCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_DENOISE));
                        testCMDList.add(new Pair<>(new Pair<>("获取噪声控制状态", geDenoiseCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("ANC-轻度",
                            BluetoothDataUtil.getDenoiseSetCMD(DenoiseMode.NOISE_MODE_DENOISE, DenoiseModeLevel.NOISE_MODE_LEVEL_MILD)),
                            new Pair<>(false, false)));
//                    testCMDList.add(new Pair<>(new Pair<>("ANC-中度",
//                            BluetoothDataUtil.getDenoiseSetCMD(DenoiseMode.NOISE_MODE_DENOISE, DenoiseModeLevel.NOISE_MODE_LEVEL_MEDIUM)),
//                            new Pair<>(false, false)));
//                    testCMDList.add(new Pair<>(new Pair<>("ANC-重度",
//                            BluetoothDataUtil.getDenoiseSetCMD(DenoiseMode.NOISE_MODE_DENOISE, DenoiseModeLevel.NOISE_MODE_LEVEL_SEVERE)),
//                            new Pair<>(false, false)));

                    testCMDList.add(new Pair<>(new Pair<>("通透-轻度",
                            BluetoothDataUtil.getDenoiseSetCMD(DenoiseMode.NOISE_MODE_TRANSPARENT, DenoiseModeLevel.NOISE_MODE_LEVEL_MILD)),
                            new Pair<>(false, false)));
//                    testCMDList.add(new Pair<>(new Pair<>("通透-中度",
//                            BluetoothDataUtil.getDenoiseSetCMD(DenoiseMode.NOISE_MODE_TRANSPARENT, DenoiseModeLevel.NOISE_MODE_LEVEL_MEDIUM)),
//                            new Pair<>(false, false)));
//                    testCMDList.add(new Pair<>(new Pair<>("通透-重度",
//                            BluetoothDataUtil.getDenoiseSetCMD(DenoiseMode.NOISE_MODE_TRANSPARENT, DenoiseModeLevel.NOISE_MODE_LEVEL_SEVERE)),
//                            new Pair<>(false, false)));

                    testCMDList.add(new Pair<>(new Pair<>("关闭-无等级",
                            BluetoothDataUtil.getDenoiseSetCMD(DenoiseMode.NOISE_MODE_OFF, DenoiseModeLevel.NOISE_MODE_LEVEL_NULL)),
                            new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_010f:
                    //设备查找
                    if (isGetStateTest) break;

                    testCMDList.add(new Pair<>(new Pair<>("查找设备-查找左右耳",
                            BluetoothDataUtil.getFindDeviceSetCMD(FindDeviceModel.LEFT_AND_RIGHT_EAR)),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("查找设备-查找左耳",
                            BluetoothDataUtil.getFindDeviceSetCMD(FindDeviceModel.LEFT_EAR)),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("查找设备-查找右耳",
                            BluetoothDataUtil.getFindDeviceSetCMD(FindDeviceModel.RIGHT_EAR)),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("查找设备-取消查找",
                            BluetoothDataUtil.getFindDeviceSetCMD(FindDeviceModel.CANCEL)),
                            new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0110:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_030b:
                    //睡眠模式
                    if (isGetStateTest) {
                        byte[] geSleepCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_SLEEP_MODEL));
                        testCMDList.add(new Pair<>(new Pair<>("睡眠模式获取", geSleepCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("睡眠模式设置-标准",
                            BluetoothDataUtil.getSleepSetCMD(SleepModel.Standard)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("睡眠模式设置-睡眠模式",
                            BluetoothDataUtil.getSleepSetCMD(SleepModel.Sleep)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("睡眠模式设置-低功耗模式",
                            BluetoothDataUtil.getSleepSetCMD(SleepModel.LowPower)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0111:
                    //空间音效模式
                    if (isGetStateTest) {
                        byte[] geSpaceSoundCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_SPACE_SOUND));
                        testCMDList.add(new Pair<>(new Pair<>("空间音效模式获取", geSpaceSoundCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("空间音效-音乐模式",
                            BluetoothDataUtil.getSpaceModelSetCMD(SpaceModel.Music)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("空间音效-运动模式",
                            BluetoothDataUtil.getSpaceModelSetCMD(SpaceModel.Sport)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("空间音效-观影模式",
                            BluetoothDataUtil.getSpaceModelSetCMD(SpaceModel.Video)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0112:
                    //沉浸式音频模式
                    if (isGetStateTest) {
                        byte[] geImmersionCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_IMMERSION_SOUND));
                        testCMDList.add(new Pair<>(new Pair<>("沉浸式音频模式获取", geImmersionCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("沉浸式音频-关闭",
                            BluetoothDataUtil.getImmersionModelSetCMD(ImmersionModel.Off)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("沉浸式音频-静态",
                            BluetoothDataUtil.getImmersionModelSetCMD(ImmersionModel.Statical)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("沉浸式音频-动态",
                            BluetoothDataUtil.getImmersionModelSetCMD(ImmersionModel.Dynamic)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0113:
                    //专注模式
                    if (isGetStateTest) {
                        byte[] getFocusModelCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_FOCUS_MODEL));
                        testCMDList.add(new Pair<>(new Pair<>("专注模式获取", getFocusModelCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("专注模式-开",
                            BluetoothDataUtil.getFocusModelSetCMD(true)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("专注模式-关",
                            BluetoothDataUtil.getFocusModelSetCMD(false)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0114:
                    //简易AI-对耳翻译模式开关指令
                    if (isGetStateTest) {
                        byte[] getAITranslateCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_AI_TRANSLATE));
                        testCMDList.add(new Pair<>(new Pair<>("对耳翻译状态获取", getAITranslateCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("对耳翻译-开",
                            BluetoothDataUtil.getAiTranslateSetCMD(true)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("对耳翻译-关",
                            BluetoothDataUtil.getAiTranslateSetCMD(false)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.TWS_SUPPORT_ID_0115:
                    //简易AI-录音转写模式开关指令（0x52）
                    if (isGetStateTest) {
                        byte[] getAudioTranscriptionCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_AI_AUDIO_TRANSCRIPTION));
                        testCMDList.add(new Pair<>(new Pair<>("录音转写状态获取", getAudioTranscriptionCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("录音转写-开",
                            BluetoothDataUtil.getAiAudioTranscriptionSetCMD(true)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("录音转写-关",
                            BluetoothDataUtil.getAiAudioTranscriptionSetCMD(false)), new Pair<>(false, false)));
                    break;

                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_0201:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_0301:
                    //音量设置与查询
                    if (isGetStateTest) {
                        byte[] getVolumeCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_VOLUME));
                        testCMDList.add(new Pair<>(new Pair<>("音量获取", getVolumeCMD), new Pair<>(false, false)));
                        break;
                    }

                    byte[] addVolumeCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_ADD_VOLUME));
                    testCMDList.add(new Pair<>(new Pair<>("音量设置-音量+", addVolumeCMD), new Pair<>(false, false)));

                    byte[] subVolumeCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_SUB_VOLUME));
                    testCMDList.add(new Pair<>(new Pair<>("音量设置-音量-", subVolumeCMD), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_0202:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_0302:
                    //播放控制
                    if (isGetStateTest) {
                        byte[] getPlayStateCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_PLAY_STATE));
                        testCMDList.add(new Pair<>(new Pair<>("获取播放状态", getPlayStateCMD), new Pair<>(false, false)));
                        break;
                    }

                    byte[] lastCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_LAST));
                    testCMDList.add(new Pair<>(new Pair<>("播放控制-上一曲", lastCMD), new Pair<>(false, false)));

                    byte[] playOrPauseCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_PLAY_PAUSE));
                    testCMDList.add(new Pair<>(new Pair<>("播放控制-播放/暂停", playOrPauseCMD), new Pair<>(false, false)));

                    byte[] nextCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_NEXT));
                    testCMDList.add(new Pair<>(new Pair<>("播放控制-下一曲", nextCMD), new Pair<>(false, false)));

                    byte[] playOnlyCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_PLAY));
                    testCMDList.add(new Pair<>(new Pair<>("播放控制-播放", playOnlyCMD), new Pair<>(false, false)));

                    byte[] pauseOnlyCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_PAUSE));
                    testCMDList.add(new Pair<>(new Pair<>("播放控制-暂停", pauseOnlyCMD), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_0208:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_0307:
                    //获取电量==>音箱/骨气传导耳机
                    if (configBean.getDeviceType() == 2) {
                        byte[] boxBatteryCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_BOX_BATTERY));
                        testCMDList.add(new Pair<>(new Pair<>("获取音箱电量", boxBatteryCMD), new Pair<>(false, false)));
                    } else if (configBean.getDeviceType() == 1) {
                        byte[] headsetBatteryCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_HEADSET_BATTERY));
                        testCMDList.add(new Pair<>(new Pair<>("获取骨气传导/头戴式耳机电量", headsetBatteryCMD), new Pair<>(false, false)));
                    }
                    break;
                case NovaDeviceConfigMessage.HEADSET_SUPPORT_ID_020a:
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_030a:
                    //TF模式设置、蓝牙模式设置、获取TF模式状态
                    if (isGetStateTest) {
                        byte[] getTfCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_TF_MODEL));
                        testCMDList.add(new Pair<>(new Pair<>("获取TF/蓝牙模式", getTfCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("模式设置-TF模式",
                            BluetoothDataUtil.getTFSetCMD(TFModel.TF)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("模式设置-蓝牙模式",
                            BluetoothDataUtil.getTFSetCMD(TFModel.Bluetooth)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_030c:
                    //灯效控制
                    if (isGetStateTest) {
                        byte[] getLightCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_LIGHT));
                        testCMDList.add(new Pair<>(new Pair<>("获取灯光模式", getLightCMD), new Pair<>(false, false)));
                        break;
                    }

                    testCMDList.add(new Pair<>(new Pair<>("灯光模式设置-默认",
                            BluetoothDataUtil.getLightSetCMD(LightModel.DefModel)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("灯光模式设置-澎湃舞动",
                            BluetoothDataUtil.getLightSetCMD(LightModel.Light1)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("灯光模式设置-交响闪烁",
                            BluetoothDataUtil.getLightSetCMD(LightModel.Light2)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("灯光模式设置-舒缓呼吸",
                            BluetoothDataUtil.getLightSetCMD(LightModel.Light3)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("灯光模式设置-极光变幻",
                            BluetoothDataUtil.getLightSetCMD(LightModel.Light4)), new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("灯光模式设置-熄灯模式",
                            BluetoothDataUtil.getLightSetCMD(LightModel.Light5)), new Pair<>(false, false)));
                    break;
                case NovaDeviceConfigMessage.BOX_SUPPORT_ID_030d:
                    //FM控制（0x69、0x70-0x75）
                    if (isGetStateTest) {
                        byte[] getFmCMD = BluetoothDataUtil.calculateCheckSumResult(
                                HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_FM));
                        testCMDList.add(new Pair<>(new Pair<>("获取FM状态", getFmCMD), new Pair<>(false, false)));
                        break;
                    }

                    byte[] getRadioCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_GET_RADIO));
                    testCMDList.add(new Pair<>(new Pair<>("FM设置-搜索电台", getRadioCMD), new Pair<>(false, false)));

                    byte[] lastRadioCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_LAST_FM));
                    testCMDList.add(new Pair<>(new Pair<>("FM设置-上一个电台", lastRadioCMD), new Pair<>(false, false)));

                    byte[] muteSetCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_MUTE_SET));
                    testCMDList.add(new Pair<>(new Pair<>("FM设置-静音开/关", muteSetCMD), new Pair<>(false, false)));

                    byte[] nextFmCMD = BluetoothDataUtil.calculateCheckSumResult(
                            HexUtil.hexStringToBytes(BluetoothDataUtil.BLE_CMD_NEXT_FM));
                    testCMDList.add(new Pair<>(new Pair<>("FM设置-下一个电台", nextFmCMD), new Pair<>(false, false)));

                    testCMDList.add(new Pair<>(new Pair<>("FM设置-FM模式：开",
                            BluetoothDataUtil.getFMModelSetCMD(true)),
                            new Pair<>(false, false)));
                    testCMDList.add(new Pair<>(new Pair<>("FM设置-FM模式：关",
                            BluetoothDataUtil.getFMModelSetCMD(false)),
                            new Pair<>(false, false)));
                    break;
            }
        });


        //结束符-识别结束
        testCMDList.add(new Pair<>(
                new Pair<>("功能指令测试结束", HexUtil.hexStringToBytes("AA00000000")),
                new Pair<>(true, true)));
        return testCMDList;
    }

    private TestCMDResultEndListener mTestCMDResultEndListener;

    public interface TestCMDResultEndListener {
        void onTestCMDResultEnd();
    }

}
